﻿using UnityEngine;
using UnityEngine.UI;

namespace UI.Panels
{
    public class HomePanel : UIPanel
    {
        private Image m_ImgGameLoadProgress;
        private Button m_BtnClose;
        
        protected override void Awake()
        {
            base.Awake();
            m_BtnClose = transform.Find("Btn_Close").GetComponent<Button>();
            m_BtnClose.transform.Find("Text").GetComponent<Text>().text = "Close";
            
            m_BtnClose.onClick.AddListener(Close);
        }
        
        public void SetGameLoadProgress(float progress)
        {
            progress = Mathf.Clamp01(progress);
            m_ImgGameLoadProgress.fillAmount = progress;
        }

        private void Close()
        {
            UIManager.Instance.ClosePanel(this);
        }
    }
}